@include("template::My.views.header")
<script src="https://cdn.bootcdn.net/ajax/libs/zepto/1.2.0/zepto.min.js"></script>
<link href="/mycms/cms/theme/My/assets/css/info.css?time={{time()}}" rel="stylesheet">
</head>
<body class="bg-gradient-to-b  from-[#EAF0FF] to-[#F9F9F9]  font-['PingFang']" >
    <div class=" mx-auto w-11/12 text-[15px] rounded-3xl  bg-[#FCBA58]  mt-5  text-white bg-[length:17px_17px]  bg-no-repeat leading-[28px] text-center bg-[center_left_10px] h-[28px]" style="background-image: url('/mycms/cms/theme/My/assets/img/x.png') "><span class="">本信息与荣誉证书同步 填写信息即可报名活动</span></div>
    
   <form method="post" id="info"  onsubmit="return info();">
    <div class="container mx-auto bg-white w-11/12  rounded-3xl h-auto flex flex-col justify-center items-center   mt-5 py-3">
        <div class="weui-cells">
            <div class="weui-cell weui-cell_active ">
                <div class="weui-cell__hd"><label for="" class="weui-label  text-[#333333] text-[16px]"><span class=" weui-cell_warn">* </span>姓名</label></div>
                <div class="weui-cell__bd">
                    <input name="name"  class="px-3 py-3 border-[0px] border-[0px]  placeholder:text-[#C6C6C6] placeholder:text-[16px]   focus:text-[#333333]  focus:text-[16px]" type="text"  value="@if($info){{$info->name}}@endif" placeholder="请输入姓名"/>
                </div>
                <div class="weui-cell__ft">
                </div>
            </div>
            <div class="weui-cell weui-cell_active">
                <div class="weui-cell__hd"><label class="weui-label"><span class=" weui-cell_warn">* </span>学校</label></div>
                <div class="weui-cell__bd">
                 <select name="school_name" class="px-3 py-3  border-[0px] focus:text-[#333333]  focus:text-[16px] w-full ">
                     <option>选择学校</option>
                     @foreach($list as $v) 
                    <option value="{{$v->name}}" @if($info&&$info->school_name==$v->name) selected @endif>{{$v->name}}</option>
                     @endforeach
                </select>
                </div>
            </div>
            <div class="weui-cell weui-cell_active ">
                <div class="weui-cell__hd"><label for="" class="weui-label text-[#333333] text-[16px]"><span class=" weui-cell_warn">* </span>年级</label></div>
                <div class="weui-cell__bd">
                   <select name="class_name" class="px-3 py-3  border-[0px] focus:text-[#333333]  focus:text-[16px] w-full ">
                    <option value="">-选择年级-</option>
                    <option value="大一" @if($info&&$info->class_name=='大一') selected @endif>-大一-</option>
                    <option value="大二" @if($info&&$info->class_name=='大二') selected @endif>-大二-</option>
                    <option value="大三" @if($info&&$info->class_name=='大三') selected @endif>-大三-</option>
                    <option value="大四" @if($info&&$info->class_name=='大四') selected @endif>-大四-</option>
                    <option value="毕业" @if($info&&$info->class_name=='毕业') selected @endif>-毕业-</option>
                </select>
                </div>
                <div class="weui-cell__ft">
                </div>
            </div>
            <div class="weui-cell weui-cell_active " >
                <div class="weui-cell__hd"><label class="weui-label"><span class=" weui-cell_warn">* </span>性别</label></div>
                <div class="weui-cell__bd">
                 <select name="sex" class="px-3 py-3  border-[0px] focus:text-[#333333]  focus:text-[16px] w-full ">
                    <option value="">-选择性别-</option>
                    <option value="男" @if($info&&$info->sex=='男') selected @endif>-男-</option>
                    <option value="女" @if($info&&$info->sex=='女') selected @endif>-女-</option>
                </select>
                </div>
            </div>
            <div class="weui-cell weui-cell_active " >
                <div class="weui-cell__hd"><label class="weui-label"><span class=" weui-cell_warn">* </span>省份</label></div>
                <div class="weui-cell__bd ">
                     <select  name="pname" class="px-3 py-3  border-[0px] focus:text-[#333333]  focus:text-[16px] w-full ">
                         <option value="">选择省份</option>
                         @foreach($region as $v)
                        <option value="{{$v->name}}" @if($info&&$info->pname==$v->name) selected @endif>{{$v->name}}</option>
                        @endforeach
                    </select>
                </div>
            </div>
            <div class="weui-cell weui-cell_active ">
                <div class="weui-cell__hd"><label for="" class="weui-label text-[#333333] text-[16px]"><span class=" weui-cell_warn">* </span>电话</label></div>
                <div class="weui-cell__bd">
                    <input class="px-3 py-3 border-[0px] placeholder:text-[#C6C6C6] placeholder:text-[16px] focus:text-[#333333]  focus:text-[16px]"  name="tel" type="number" pattern="[0-9]*" placeholder="请输入电话" value="@if($info&&$info->tel){{$info->tel}}@else{{$mobile}}@endif"/>
                </div>
                <div class="weui-cell__ft">
                    <!-- <i class="weui-icon-warn"></i> -->
                </div>
            </div>
        </div>
    </div>
    <div class="container mx-auto flex flex-col justify-center items-center mt-10  mb-10">
        <button  class="bg-[#3368FD]  rounded-full shadow-xl shadow-blue-400/30  w-[171px]  h-[50px]   text-white font-bold text-[19px]" >确认无误</button>
    </div>
    </form>
    <br/><br/><br/>
<script>

    function info()
    {
        $.ajax({
            url: '{{route('user.info')}}',
            type: 'post',
            contentType: "application/x-www-form-urlencoded; charset=UTF-8",
            dataType: "json",
            data: $('#info').serialize(),
            timeout: 60000,
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            },
            success: function (res) {
                alert(res.msg);
                location.href = "{{$referrer}}";  
            },
            error: function (xhr,error) {
                jsonObj=JSON.parse(xhr.response)
                console.log(xhr);
                alert(jsonObj.msg);
                return false;
            }
        });
        return false;
    }
</script>
@include("template::My.views._footer")